export default {
  created () {
    const applyNo = this.$route.query['applyNo']
    if (!this.$lodash.isEmpty(applyNo)) {
      this.$service.apply.detail({ applyNo }).then(data => {
        const time = {}
        Object.assign(this.form, data)
        if (!this.$lodash.isEmpty(data.beginTime)) {
          time.beginTime = this.$dateUtils.parseDate(data.beginTime)
        }
        if (!this.$lodash.isEmpty(data.endTime)) {
          time.endTime = this.$dateUtils.parseDate(data.endTime)
        }
        Object.assign(this, time)
        if (data.hours) {
          // 覆盖自动计算的小时数
          setTimeout(() => {
            this.form.hours = data.hours
          }, 200)
        }
      })
    }
  }
}
